<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>换届信息添加页面</title>
  <link rel="stylesheet" href="../../yl/index.css" />
  <!-- 布局样式 -->
  <link rel="stylesheet" href="../../yl/style.css" />
  <link rel="stylesheet" href="../../yl/mobile.css" />
  <link rel="stylesheet" href="../../yl/easyui.css" />
  <link rel="stylesheet" href="../../yl/icon.css" />
  <style>
    .el-table tr {
      height: 60px;
    }

    .el-table th.el-table__cell {
      background-color: #f5f7fa !important;
      color: #606266;
    }

    .el-table__row .cell {
      display: flex;
      align-items: center;
    }
  </style>
</head>

<body>
  <!-- <div id="app"> -->
  <div class="easyui-navpanel" id="app" v-cloak>
    <header>
      <div class="m-toolbar">
        <div class="m-title">{{action=='Add'?'添加换届信息':action=='Modify'?'修改换届信息':''}}</div>
      </div>
    </header>
    <div class="easyui-navpanel panel-body panel-body-nobottom panel-body-noborder" style="height: 3000px"
      id="MainTable" ref="MainTable"
      :data-options="JSON.stringify({ 'TableName': 'village_leaders_tenure', 'form': 'dataForm','primary_key':'Tenure_SerialNumber' })">
      <div class="yl-main">
        <div class="table_titel">
          <div class="titel">换届信息</div>
        </div>
        <el-form :model="dataForm" ref="form" :inline-message="true" style="width: 100%">
          <el-descriptions :column="1" size="large" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">村集体</div>
              </template>
              <el-form-item prop="VillageNumber" :rules="[{ required: true, message: '请选择村集体', trigger: 'change' }]">
                <yl-cascader :disabled="action=='Modify'" @change="changeOrganization" v-model="dataForm.VillageNumber" placeholder="请选择村集体"
                  :options="city" :props="{ value:'ProvinceNumber', label:'Province'}"></yl-cascader>
              </el-form-item>
            </el-descriptions-item>
            <!-- <el-descriptions-item>
              <template #label>
                <div class="cell-item">任职</div>
              </template>
              <el-form-item prop="Tenure" :rules="[{ required: true, message: '请选择任职（选择党组后自动匹配）', trigger: 'blur' }]">
                <el-input disabled v-model="dataForm.Tenure" class="borderless-input" placeholder="请输入任职" />
              </el-form-item>
            </el-descriptions-item> -->
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">任职开始时间</div>
              </template>
              <el-form-item prop="Start_Date" :rules="[{ required: true, message: '请选择任职开始日期', trigger: 'change' }]">
                <el-date-picker :disabled="dataForm.Tenure!='第一任'||action=='Modify'" v-model="dataForm.Start_Date" format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD" class="borderless-input" type="date" placeholder="请选择任职开始日期" size="large" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item v-if="action == 'Modify'">
              <template #label>
                <div class="cell-item">任职结束时间</div>
              </template>
              <el-form-item prop="End_Date"
                :rules="[{ required: true, validator:End_Date_Validity, trigger: 'change' }]">
                <el-date-picker v-model="dataForm.End_Date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                  class="borderless-input" type="date" placeholder="请选择任职结束日期" size="large" />
              </el-form-item>
            </el-descriptions-item>
          </el-descriptions>
        </el-form>
        <div id="ChildTable">
          <div class="table_titel">
            <div class="titel">包村领导</div>
          </div>
          <el-form :model="{childDataForm}" ref="form1" :inline-message="true" style="width: 100%">
            <el-descriptions
              :data-options="JSON.stringify({ 'TableName': 'village_leaders_tenure_member', 'form': 'childDataForm', 'ParentTableName': 'Work_Team_SerialNumber'})"
              :column="1" size="large" border
              v-for="(item,index) in childDataForm.filter(item => item.Row_Status != '1')" :key="index">
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">头像</div>
                </template>
                <el-form-item :prop="'childDataForm.' + index + '.Accession_Date'"
                  :rules="[{ required: true, message: '请选择就职日期', trigger: 'change' }]">
                  <yl-upload v-if="!isLeave" v-model="item.Picture_URL"></yl-upload>
                  <div v-else style="width: 120px;height: 120px;display: flex;justify-content: center;align-items: center;">
                    <el-image v-if="item.Picture_URL" :src="photo + item.Picture_URL"></el-image>
                    <span v-else>暂无头像</span>
                  </div>
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">领导</div>
                </template>
                <el-form-item :prop="'childDataForm.' + index + '.ID_Card_Number'" :rules="[{ required: true, message: '请选择就职日期', trigger: 'change' }]">
                  <yl-select v-model="item.ID_Card_Number" clearable filterable placeholder="请选择领导"
                    :options="personal_information" :props="{value:'ID_Card_Number',label:'Personal_Name'}">
                    <el-table-column prop="ID_Card_Number" width="180" show-overflow-tooltip
                      label="身份证号"></el-table-column>
                    <el-table-column prop="Personal_Name" show-overflow-tooltip label="姓名"></el-table-column>
                    <el-table-column prop="Birthday" show-overflow-tooltip label="出生日期"></el-table-column>
                    <el-table-column prop="Gender" label="性别"></el-table-column>
                    <el-table-column prop="Nation" label="民族"></el-table-column>
                    <el-table-column prop="Registered_Residence" show-overflow-tooltip label="籍贯"></el-table-column>
                    <el-table-column prop="Contact_Phone" label="联系方式"></el-table-column>
                  </yl-select>
                </el-form-item>
              </el-descriptions-item>
              <template v-if="!isLeave" >
                <el-descriptions-item>
                  <template #label>
                    <div class="cell-item">就职日期</div>
                  </template>
                  <el-form-item :prop="'childDataForm.' + index + '.Accession_Date'"
                    :rules="[{ required: true, message: '请选择日期', trigger: 'change' }]">
                    <el-date-picker v-model="item.Accession_Date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                      class="borderless-input" type="date" placeholder="请选择日期" size="large" />
                  </el-form-item>
                </el-descriptions-item>
                <!-- <el-descriptions-item>
                  <template #label>
                    <div class="cell-item">当选日期</div>
                  </template>
                  <el-form-item :prop="'childDataForm.' + index + '.Election_Date'" :rules="[{ required: true, message: '请选择当选日期', trigger: 'change' }]">
                    <el-date-picker v-model="item.Election_Date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                      class="borderless-input" type="date" placeholder="请选择当选日期" size="large" />
                  </el-form-item>
                </el-descriptions-item> -->
              </template>
              <template v-else>
                <el-descriptions-item>
                  <template #label>
                    <div class="cell-item">实际结束日期</div>
                  </template>
                  <el-form-item :prop="'childDataForm.' + index + '.Actual_End_Date'" :rules="[{ required: true, message: '请选择日期', trigger: 'change' }]">
                    <el-date-picker v-model="item.Actual_End_Date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
                      class="borderless-input" type="date" placeholder="请选择日期" size="large" />
                  </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item>
                  <template #label>
                    <div class="cell-item">离任类型</div>
                  </template>
                  <el-form-item :prop="'childDataForm.' + index + '.Leave_Type'" :rules="[{ required: true, message: '请选择离任类型', trigger: 'change' }]">
                    <el-select v-model="item.Leave_Type" placeholder="请选择离任类型" size="large">
                      <el-option
                        v-for="(item,index) in [{value:'1',label:'正常届满'},{value:'2',label:'调动'},{value:'3',label:'辞职'},{value:'4',label:'罢免'},{value:'5',label:'其他'}]"
                        :key="index" :label="item.label" :value="item.value" />
                    </el-select>
                  </el-form-item>
                </el-descriptions-item>
              </template>
          </el-form>
        </div>
      </div>
    </div>
    <footer class="botton-ann">
      <el-button @click="goBack">返回</el-button>
      <el-button type="primary" plain @click="handleSubmit" :loading="loading">提交</el-button>
    </footer>
  </div>
</body>
<script src="../../yl/vue.js"></script>
<script src="../../config/config.js"></script>
<script src="../../utils/compressor.js"></script>
<script src="../../utils/utils.js"></script>
<script src="../../utils/mixins.js"></script>
<script src="../../yl/index.js"></script>
<script src="../../yl/zh-cn.mjs"></script>
<script src="../../yl/index.iife.min.js"></script>
<script src="../../yl/jquery.min.js"></script>
<script src="../../utils/jquery.cookie.js"></script>
<script src="../../yl/jquery.easyui.min.js"></script>
<script src="../../yl/jquery.easyui.mobile.js"></script>
<script src="../../yl/moment.min.js"></script>
<script src="../../api/request.js"></script>
<script src="./js/add.js"></script>

</html>